* NOTE: You need to set the Stata working directory to the path
* where the data file is located.

set more off

clear
quietly infix                   ///
  str     year       1-9        ///
  str     regiona    10-10      ///
  str     divisiona  11-11      ///
  str     state      12-35      ///
  str     statea     36-37      ///
  str     county     38-94      ///
  str     countya    95-97      ///
  str     cousuba    98-102     ///
  str     placea     103-107    ///
  str     tracta     108-113    ///
  str     concita    114-118    ///
  str     aianhha    119-122    ///
  str     res_onlya  123-126    ///
  str     trusta     127-130    ///
  str     aitscea    131-133    ///
  str     anrca      134-138    ///
  str     cbsaa      139-143    ///
  str     csaa       144-146    ///
  str     metdiva    147-151    ///
  str     nectaa     152-156    ///
  str     cnectaa    157-159    ///
  str     nectadiva  160-164    ///
  str     uaa        165-169    ///
  str     cdcurra    170-171    ///
  str     sldua      172-174    ///
  str     sldla      175-177    ///
  str     zcta5a     178-182    ///
  str     submcda    183-187    ///
  str     sdelma     188-192    ///
  str     sdseca     193-197    ///
  str     sdunia     198-202    ///
  str     puma5a     203-207    ///
  str     bttra      208-213    ///
  str     name_e     214-1213   ///
  double  advbe001   1214-1222  ///
  double  advbe002   1223-1231  ///
  double  advbe003   1232-1240  ///
  str     name_m     1241-2240  ///
  double  advbm001   2241-2249  ///
  double  advbm002   2250-2258  ///
  double  advbm003   2259-2267  ///
  using `"nhgis0050_ds216_20155_2015_county.dat"'


format advbe001  %9.0f
format advbe002  %9.0f
format advbe003  %9.0f
format advbm001  %9.0f
format advbm002  %9.0f
format advbm003  %9.0f

label var year      `"Data File Year"'
label var regiona   `"Region Code"'
label var divisiona `"Division Code"'
label var state     `"State Name"'
label var statea    `"State Code"'
label var county    `"County Name"'
label var countya   `"County Code"'
label var cousuba   `"County Subdivision Code"'
label var placea    `"Place Code"'
label var tracta    `"Census Tract Code"'
label var concita   `"Consolidated City Code"'
label var aianhha   `"American Indian Area/Alaska Native Area/Hawaiian Home Land Code"'
label var res_onlya `"American Indian Area/Alaska Native Area (Reservation or Statistical Entity Only)"'
label var trusta    `"American Indian Area (Off-Reservation Trust Land Only)/Hawaiian Home Land Code"'
label var aitscea   `"Tribal Subdivision/Remainder Code"'
label var anrca     `"Alaska Native Regional Corporation Code"'
label var cbsaa     `"Metropolitan Statistical Area/Micropolitan Statistical Area Code"'
label var csaa      `"Combined Statistical Area Code"'
label var metdiva   `"Metropolitan Division Code"'
label var nectaa    `"New England City and Town Area Code"'
label var cnectaa   `"Combined New England City and Town Area Code"'
label var nectadiva `"New England City and Town Area Division Code"'
label var uaa       `"Urban Area Code"'
label var cdcurra   `"Congressional District (2013-2017, 113th-114th Congress) Code"'
label var sldua     `"State Legislative District (Upper Chamber) Code"'
label var sldla     `"State Legislative District (Lower Chamber) Code"'
label var zcta5a    `"5-Digit ZIP Code Tabulation Area Code"'
label var submcda   `"Subminor Civil Division Code"'
label var sdelma    `"School District (Elementary)/Remainder Code"'
label var sdseca    `"School District (Secondary)/Remainder Code"'
label var sdunia    `"School District (Unified)/Remainder Code"'
label var puma5a    `"Public Use Microdata Sample Area (PUMA) Code"'
label var bttra     `"Tribal Census Tract Code"'
label var name_e    `"Estimates: Area Name"'
label var advbe001  `"Estimates: Total"'
label var advbe002  `"Estimates: Native"'
label var advbe003  `"Estimates: Foreign-Born"'
label var name_m    `"Margins of error: Area Name"'
label var advbm001  `"Margins of error: Total"'
label var advbm002  `"Margins of error: Native"'
label var advbm003  `"Margins of error: Foreign-Born"'


